import requests
import re
from bs4 import BeautifulSoup
import pymysql.cursors
connect = pymysql.Connect(
    host='###mysqlurl',
    port=3306,
    user='###username',
    passwd='###password',
    db='###database',
    charset='utf8'
)



conTextAll="a"

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36'
}

response = requests.get('###url', headers=headers)

print(response.text)
soup = BeautifulSoup(response.text,'html.parser')
for span in soup.find_all(class_='###classname'):

    span2=span.text
    print(span2)
    cursor = connect.cursor()
    sql = "insert into database.###classname values ('%s')"
    data = (span2)
    print(sql % data)
    cursor.execute(sql % data)
    connect.commit()

